strict string to int[long]

Posted by baskin on Stack Overflow See other posts from Stack Overflow or by baskin
Published on 2010-06-17T21:16:41Z Indexed on 2010/06/17 21:23 UTC
Read the original article Hit count: 172

Filed under:

Do we have a standard way of converting a char* to int (or long) in a strict way, i.e. we should get proper result only if all characters are digits and can fit in an int (or long) -- some way by using strtol etc.. ?

Thus "sbc45", "4590k", " 56", "56 ", should be all invalid using that function.

© Stack Overflow or respective owner

Related posts about c++